# -*- coding: utf-8 -*-
class WashMachine():
    def __init__(self,brand,capacity):
        self.brand = brand
        self.capacity = capacity
        self.is_closed = False
        self._mode = 0
        self.motor_speed = 0
    def open_door(self):
        self.is_closed = False
        print('洗衣机开门')
    def close_door(self):
        self.is_closed = True
        print('洗衣机关门')
    def set_mode(self,new_mode):
        self._mode = new_mode

    def _set_motor_speed(self,speed):
        self.motor_speed = speed

    def wash(self):
        if not self.is_closed: #默认是开门，提示要关门
            print('请关闭洗衣机门......')
            return
        elif self._mode == 0:
            print('请设置洗衣模式')
            return
        print("正在加水")
        print('加满了')
        if self._mode == 1:
            print('轻柔模式，洗内衣')
            self._set_motor_speed(1000)
            print('马达转速：{}'.format(self.motor_speed))
            print('开始洗衣...')
        elif self._mode == 2:
            print('狂揉模式，洗外套')
            self._set_motor_speed(2000)
            print('马达转速：{}'.format(self.motor_speed))
            print('开始洗衣...')

        print('洗完了')
machine = WashMachine('海尔',10)
machine.open_door()
machine.close_door()
machine.set_mode(1)
machine.wash()

